<?php echo $this->doctype() ?>
<?php
//get user info
$objAuth = Zend_Auth::getInstance();
if ($objAuth->hasIdentity()) {
    $userInfo = $objAuth->getIdentity();
}
?>
<html>
    <head>

        <?php echo $this->headMeta() ?>

        <?php echo $this->headTitle() ?>

        <link rel="shortcut icon" href="<?php echo $this->baseUrl() ?>/images/favicon.ico">

        <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
        <!--[if lt IE 9]>
          <script src="/js/html5shiv.js"></script>
          <script src="/js/respond.min.js"></script>
        <![endif]-->
        <?php
        $front = Zend_Controller_Front::getInstance();

        if ($front->getRequest()->getControllerName() != "index") {
            $this->headLink()->appendStylesheet($this->baseUrl() . "/css/dashboard-styles.css");
        }
        ?>
<?php echo $this->headLink() ?>


    </head>
    <body>
        <?php
        $front = Zend_Controller_Front::getInstance();

        if ($front->getRequest()->getControllerName() != "index") {
            ?>

            <div class="header">
                <div class="container">
                    <div class="row">
                        <div class="col-md-4">
                            <!-- Logo -->
                            <div class="logo">
                                <h1><a href="<?php echo $this->baseUrl() ?>/administration/index/index"><span class="glyphicon glyphicon-wrench">CPanel</span></a></h1>
                            </div>
                        </div>
                        <div class="col-md-5">
                            <a  class="btn btn-default pull-right" target="_blank" href="/<?= $this->baseUrl() ?>"><span class="glyphicon glyphicon-log-in"> Website</span></a>
                        </div>
                        <div class="col-md-3">
                            <div class="navbar navbar-inverse" role="banner">
                                <nav class="collapse navbar-collapse bs-navbar-collapse navbar-right" role="navigation">

                                    <ul class="nav navbar-nav">

                                        <li class="dropdown">
                                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                                <?php
                                                if ($userInfo->image) {
                                                    echo '<img class="img-circle" width="32px" height="32px" src="' . $this->baseUrl() . '/upload/profile/' . $userInfo->image . '" />';
                                                } else {
                                                    echo '<img class="img-circle" width="32px" height="32px" src="' . $this->baseUrl() . '/images/default_image.png" />';
                                                }
                                                ?>
                                                    <?php echo"Welcome <span class='label label-default'>" . $userInfo->firstName . " " . $userInfo->lastName . "</span>" ?>
                                                <b class="caret"></b></a>
                                            <ul class="dropdown-menu animated fadeInUp">
                                                <li><a href="<?= $this->baseUrl() ?>/administration/user/profile">Profile</a></li>
                                                <li><a href="<?= $this->baseUrl() ?>/administration/index/logout">Logout</a></li>
                                            </ul>
                                        </li>

                                    </ul>
                                </nav>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="page-content">
                <div class="row">
                    <div class="col-md-2">
                        <div class="sidebar content-box" style="display: block;">
                            <ul class="nav">
                                <!-- Main menu -->
                                <li class="current"><a href="<?php echo $this->baseUrl() ?>/administration/dashboard"><i class="glyphicon glyphicon-home"></i> Dashboard</a></li>
                                 <li class="submenu">
                                    <a href="#">
                                        <i class="glyphicon glyphicon-tower"></i> Admission Interviews
                                        <span class="caret pull-right"></span>
                                    </a>
                                    <!-- Sub menu -->
                                    <ul>
                                        <li><a href="<?php echo $this->baseUrl() ?>/administration/admissioninterview"><i class="glyphicon glyphicon-hand-right"></i> Interview</a></li>
                                        <li><a href="<?php echo $this->baseUrl() ?>/administration/applicant"><i class="glyphicon glyphicon-user"></i> Applicants</a></li>
                                        <li><a href="<?php echo $this->baseUrl() ?>/administration/admissioncategory"><i class="glyphicon glyphicon-folder-close"></i> Categories</a></li>
                                        <li><a href="<?php echo $this->baseUrl() ?>/administration/admissionquestion"><i class="glyphicon glyphicon-question-sign"></i> Questions</a></li>
                                        <li><a href="<?php echo $this->baseUrl() ?>/administration/applicantresult"><i class="glyphicon glyphicon-stats"></i> Results</a></li>                                       
                                    </ul>
                                </li>
                                
                                <li class="submenu">
                                    <a href="#">
                                        <i class="glyphicon glyphicon glyphicon-home"></i> Main Page
                                        <span class="caret pull-right"></span>
                                    </a>
                                    <!-- Sub menu -->
                                    <ul>
                                        <li><a href="<?php echo $this->baseUrl() ?>/administration/poll"><i class="glyphicon glyphicon-tasks"></i> Polls</a></li>
                                        <li><a href="<?php echo $this->baseUrl() ?>/administration/video"><i class="glyphicon glyphicon-facetime-video"></i> Videos</a></li>
                                        <li><a href="<?php echo $this->baseUrl() ?>/administration/event"><i class="glyphicon glyphicon-calendar"></i> Events</a></li>
                                    </ul>
                                </li>
                                <li><a href="<?php echo $this->baseUrl() ?>/administration/menu"><i class="glyphicon glyphicon-th"></i> Main Menu</a></li>
                                <li class="submenu">
                                    <a href="#">
                                        <i class="glyphicon glyphicon-bullhorn"></i> News
                                        <span class="caret pull-right"></span>
                                    </a>
                                    <!-- Sub menu -->
                                    <ul>
                                        <li><a href="<?php echo $this->baseUrl() ?>/administration/news">Articles</a></li>
                                        <li><a href="<?php echo $this->baseUrl() ?>/administration/newscategory">Categories</a></li>

                                    </ul>
                                </li>
                                <li><a href="<?php echo $this->baseUrl() ?>/administration/page"><i class="glyphicon glyphicon-pencil"></i> Pages</a></li>
                                <li><a href="<?php echo $this->baseUrl() ?>/administration/user"><i class="glyphicon glyphicon-user"></i> Users</a></li>

                                <li class="submenu">
                                    <a href="#">
                                        <i class="glyphicon glyphicon-flash"></i> Privileges
                                        <span class="caret pull-right"></span>
                                    </a>
                                    <!-- Sub menu -->
                                    <ul>
                                        <li><a href="<?php echo $this->baseUrl() ?>/administration/resource">Build Resources</a></li>
                                        <li><a href="<?php echo $this->baseUrl() ?>/administration/role">Roles</a></li>

                                    </ul>
                                </li>
                            </ul>
                        </div>
                    </div>

                    <div class="col-md-10">

    <?php echo $this->layout()->content ?>
                    </div>
                </div>
            </div>
        <?php } else {
            ?>
            <div class="container">

                <?php
                if ($objAuth->hasIdentity()) {
                    $_redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
                    $_redirector->gotoUrl($this->baseUrl() . "/administration/dashboard");
                }
                echo $this->layout()->content;
                ?>
            </div>
        <?php } ?>
        <?php $this->headScript()->captureStart() ?>
        var baseUrl = "<?php echo $this->baseUrl() ?>";
        var originalModule =  "<?php echo Zend_Controller_Front::getInstance()->getRequest()->getModuleName() ?>";
        var originalController =  "<?php echo Zend_Controller_Front::getInstance()->getRequest()->getControllerName() ?>";
        <?php $this->headScript()->captureEnd() ?>
        <?php $this->headScript()->appendFile($this->baseUrl() . "/js/dashboard.js"); ?>
        <?php $this->headScript()->appendFile($this->baseUrl() . '/js/actions.js'); ?>
        <?php echo $this->headScript() ?>
    </body>
</html>
